import { Context, Next } from 'koa';

export const ResponseMiddleware = (ctx: Context, next: Next) => {
  ctx.success = ({ data, msg }) => {
    ctx.body = { code: 0, result: data, message: msg };
  };

  return next();
};
